from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from tasks.models import Task, TaskList, Report, LeftWork

@login_required
def tasks(request, list_id=None):

    tasks = Task.objects.filter(user=request.user) if list_id is None else Task.objects.filter(user=request.user, list_id=list_id)
    context = {
        'lists': TaskList.objects.filter(user=request.user),
        'tasks': tasks,
    }
    return render_to_response('tasks.html', context)
    
@login_required
def burning_chart(request, period_id=None):
    pass
    
@login_required
def report(request, period_id=None):
    context = {
        'up_left_name': Report.GOOD_NAME,
        'up_right_name': Report.BAD_NAME,
        'down_left_name': Report.MORE_NAME,
        'down_right_name': Report.LESS_NAME
    }
    return render_to_response('report.html', context)
    

@login_required
def period(request, period_id=None):
    pass